const api = require('../../config/everyLunbo.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    htmlSnip:'',
    htmlSnipyeji:'',
    htmlSniphuojiang:'',
    img:"https://p3.pstatp.com/large/43700001e49d85d3ab52",
    message:'21311232132121331',
    advertisementtype:'',
    id:'',
    lists:"",
    achievement:'',
    awardWinning:'',
    companyBrief:''
  },
  getList() {
    wx.request({
      url: api.list, //仅为示例，并非真实接口地址。
      data: {
        type:this.data.advertisementtype,
        id:this.data.id
      },
      responseType :'text',
      // header:{'Content-Type': 'application/octet-stream;charset:utf-8'},
      header:{'Content-Type': 'binary ;charset:utf-8'},
     method:'GET',
      success: (res) => {
        if(res.data.code === 100) {
          let obj = res.data.object
          let achievement =  obj.achievement  ?obj.achievement.replace(/<img/g, '<img class="richImg"'):''
          let awardWinning =  obj.awardWinning?obj.awardWinning.replace(/<img/g, '<img class="richImg"'):''
          let companyBrief =  obj.companyBrief?obj.companyBrief.replace(/<img/g, '<img class="richImg"'):''
          this.setData({
            lists:obj
          })
          this.setData({
            achievement
          })
          this.setData({
            awardWinning
          })
          this.setData({
            companyBrief
          })
        }
        
      }
    });
  },


  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    const {advertisementtype,id} = options
    this.setData({
      advertisementtype
    })
    this.setData({
      id
    })
    this.getList()
    const htmlSnip =
`<div class="div_class">
  <h1>Title</h1>
  <p class="p">
    Life is&nbsp;<i>like</i>&nbsp;a box of
    <b>&nbsp;chocolates</b>.
  </p>
  <div>31212421</div>
</div>
`
this.setData({
  htmlSnip:htmlSnip,
  htmlSnipyeji:htmlSnip,
  htmlSniphuojiang:htmlSnip
})
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})